/*
 *  $Id: ScorchAttack.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: обжигающая атака
    /// Параметр: сила ожога после атаки
    /// При атаке наносит врагу ожог указанной силы.
    /// </summary>
    public class ScorchAttack: Affect {
        public readonly int Value;

        public ScorchAttack(int value) {
            Value = value;
        }

        public override string Id {
            get { return "scorch.attack"; }
        }
        public override string NameText {
            get { return Name.GetText(Value); }
        }

        public override int BaseWeight {
            get { return Value * 25; }
        }

        public override Affect Clone() {
            return new ScorchAttack(Value);
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.OnHit += DoScorch;
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.OnHit -= DoScorch;
        }

        private void DoScorch(Creature hitter, AbstractObject target, int damage) {
            if (target is Creature)
                target.AddAffect(new Scorch(Value));
        }
    }
}